<extend name="Public:base"/>

<block name="body">
    <style type="text/css">
        * {
            list-style: none;
        }

        #body {

            width: 95%;

            background: white;

            border-radius: 10px;

            margin: 2.5%;

            position: relative;

        }

        .add_button {
            margin: 20px 30px;
            height: 40px;
            width: 80px;
        }

        .top_input_button {

            width: 300px;

            height: 42px;

        }

        .btn-default {

            color: #fff;

            background-image: none;

            background-color: rgba(255, 150, 47, 1);

            border: none;

        }

        .btn-default:focus, .btn-default:hover {

            color: #fff;

            background-image: none;

            border: none;

            background-color: rgba(255, 150, 47, 1);

        }

        tr > td > span {

            margin: 5px;

            color: #00aaee;

        }

        thead > tr > th {

            text-align: center;

        }

        #data_tr > td {

            text-align: center;

        }

        form ul > li {
            margin: 10px;
        }

        #table_form > div {
            padding: 10px;
        }

        .file-box {
            display: inline-block;
            position: relative;
            top: 15px;
            padding: 3px 5px;
            overflow: hidden;
            border: solid 1px #ccc;
            border-radius: 8px;
        }

        .file-btn {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 15px;
            left: 0;
            outline: none;
            background-color: transparent;
            filter: alpha(opacity=0);
            -moz-opacity: 0;
            -khtml-opacity: 0;
            opacity: 0;
        }


    </style>
    <div id="body">

        <div style="width: 100%;height: 80px;position: relative">
            <div style="position: absolute;right: 115px;top:20px">
                <input type="text" id="like_code" class="form-control top_input_button" placeholder="请输入活动项目名称"
                       aria-describedby="sizing-addon1">
            </div>

            <div style="position: absolute;right: 20px;top:0">
                <button type="button" id="like" class="btn btn-default  add_button" style="width: 60px">查询</button>
            </div>
        </div>

        <ul class="nav nav-tabs" style="margin: 30px;">
            <li role="presentation"><a href="{:U('project/data')}">资料列表</a></li>
            <li role="presentation"><a href="{:U('project/video')}">视频列表</a></li>
            <li role="presentation"><a href="{:U('project/advertise')}">广告列表</a></li>
            <li role="presentation" class="active"><a href="#">回收站</a></li>
        </ul>

        <div class="row" style="margin-left: 15px;width: 97%">
            <form id="form" method="post" action="" onsubmit="return false">
                <div class="col-xs-12">
                    <table class="table table-striped table-bordered">
                        <thead>
                        <tr>
                            <th class="center"><input class="check-all" type="checkbox" value=""></th>
                            <th>编号</th>
                            <th>活动名称</th>
                            <th>类型</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>

                        <volist name="data" id="vo">
                            <tr id="data_tr" style="overflow: hidden">
                                <td class="center">
                                    <input class="uids" type="checkbox" name="uids[]" value="{$vo.id}-{$vo.type}">
                                </td>
                                <td>{$vo.id}</td>
                                <td>{$vo.name}</td>
                                <td>{$vo.type}</td>
                                <td>{$vo.time}</td>
                                <td>
                                    <span onclick="group_table('{$vo.id}','{$vo.type}')">还原</span>
                                </td>
                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    <button type="button" id="submit" class="btn add_button" style="width: 60px">还原</button>
                    {$page}
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </form>
        </div>
    </div>
    <script>
        $(".check-all").click(function () {
            $(".uids").prop("checked", this.checked);
        });
        $(".uids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.dialog({
                message: '是否还原所选项目',
                title: "系统提示",
                buttons: {
                    success: {
                        label: "关闭",
                        className: "btn-danger",
                        callback: function () {
                        }
                    },
                    "Danger": {
                        label: "还原",
                        className: "btn-success",
                        callback: function () {
                            arr = [];
                            $.each($('.uids:checkbox'), function () {
                                if (this.checked) {
                                    arr.push($(this).val());
                                }
                            });
                            str = arr.join(',');
                            if (arr.length > 0) {
                                $.post('recycle', {id: str, key: 'edits'}, function (res) {
                                    bootbox.alert({title: "系统提示", message: res.msg});
                                    setTimeout(function () {
                                        location.reload();
                                    }, 2000)
                                })
                            }
                        }
                    }
                }
            });
        });

        function group_table(id, type) {
            $.post('recycle', {id: id, key: 'edit', type: type}, function (res) {
                if (res.code) {
                    bootbox.alert({title: "系统提示", message: res.msg});
                    setTimeout(function () {
                        location.reload();
                    }, 2000)
                } else {
                    bootbox.alert({title: "系统提示", message: res.msg});
                }
            })
        }

        $('#like').click(function () {

            like = $('#like_code').val();

            window.location.href = '{:U("Dxadmin/project/recycle")}?like=' + like;

        })

    </script>

</block>